package name.huzhenbo.java.collection;

class SortedListIterator {
    private SortedListItem head;

    private SortedListIterator(SortedListItem head) {
        this.head = new SortedListItem(0, head);
    }

    public int next() {
        head = head.next();
        return head.val();
    }

    public boolean hasNext() {
        return head.next() != null;
    }

    public static SortedListIterator getInstance(SortedListItem head) {
        return new SortedListIterator(head);
    }
}
